package HelloAlgo.sort;

import java.util.Arrays;

public class SelectSort {
    public static void main(String[] args) {
        int[] nums = {5,2,5,1,4,6,1,4,7,3};
        SelectSort selectSort = new SelectSort();
        selectSort.selectionSort(nums);
        Arrays.stream(nums).forEach(num -> System.out.println(num));
    }
     void selectionSort(int[] nums){
        int size = nums.length;

        for(int i = 0;i<size-1;i++){
            int k = i;
            for(int j =i+1;j<size;j++){
                if(nums[k]>nums[j]){
                    int temp = nums[k];
                    nums[k] = nums[j];
                    nums[j] = temp;
                }
            }
        }
     }
}
